package Thread;

/**
 * 获取线程信息的相关方法
 */
public class ThreadInfoDemo {
    public static void main(String[] args) {
        Thread main = Thread.currentThread();
        String name = main.getName();
        System.out.println(name);

        long id = main.getId();
        System.out.println("唯一标识:"+id);//获取优先级

        boolean isLive = main.isAlive();
        System.out.println("是否活着"+isLive);//是否活着

        boolean isDeamon = main.isDaemon();
        System.out.println("是否为守护线程"+isDeamon);//是否为守护线程

        boolean isInterrupted  = main.isInterrupted();
        System.out.println("是否被中断了"+ isInterrupted);//是否被中断
    }
}
